//
//  HXGetLabelSizeFromStr.m
//  NewsDemo
//
//  Created by 何欣 on 15/7/6.
//  Copyright (c) 2015年 何欣. All rights reserved.
//

#import "HXGetLabelSizeFromStr.h"

@implementation HXGetLabelSizeFromStr


+(CGSize)labelFitHeight:(NSString *)str andFontSize:(CGFloat)fontSize
{
    UIFont *font = [UIFont systemFontOfSize:fontSize];
    
    NSDictionary  *dic = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil];
    CGSize actualsize = [str boundingRectWithSize:CGSizeMake(KScreenWidth - 20, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil].size;
    
    return actualsize;
}

@end
